import axios from "../utils/requests.js";       //引入封装好的axios
import base from "./base.js";                   //引入接口列表

const api = {
    /**
     * 登录功能
    */
    get_taobao_items(params) {
        return axios({
            method:'get',
            url:base.baseURL + base.taobao_items,
            params:params
        })
    },
    update_taobao_item(params) {
        return axios({
            method:'put',
            url:base.baseURL + base.taobao_item,
            data:params
        })
    },
    get_taobao_item(params) {
        return axios({
            method:'get',
            url:base.baseURL + base.taobao_item,
            params:params
        })
    },
    del_taobao_items(params) {
        return axios({
            method:'delete',
            url:base.baseURL + base.taobao_item,
            data:params,
            headers:{
                'Content-Type':"application/json"
            }
        })
    },
    get_tb1688_offers(params){
        return axios({
            method:'get',
            url:base.baseURL + base.tb_1688_offers,
            params:params
        })
    },
    get_tb1688_shops(params){
        return axios({
            method:'get',
            url:base.baseURL + base.tb_1688_shops,
            params:params
        })
    },
    get_categories(params){
        return axios({
            method:'get',
            url:base.baseURL + base.get_categories,
            params:params
        })
    },
    update_category(params,id){
        return axios({
            method:'put',
            url:`${base.baseURL}${base.update_category}${id}/`,
            data:params
        })
    },
    delete_category(id){
        console.log(id)
        return axios({
            method:'delete',
            url:`${base.baseURL}${base.delete_category}${id}/`
        })
    },
    add_category(params){
        return axios({
            method:'post',
            url:base.baseURL + base.add_category,
            data:params
        })
    },
    get_supplier(params){
        return axios({
            method:'get',
            url:base.baseURL + base.get_supplier,
            params:params
        })
    },
    OSSgetDirectory(params){
        return axios({
            method:'get',
            url:base.baseURL + base.OSSgetDirectory,
            params:params
        })
    },
    item_rank_by_category(params){
        return axios({
            method:'get',
            url:base.baseURL + base.item_rank_by_category,
            params:params
        })
    },
    getIPs(params){
        return axios({
            method:'get',
            url:base.baseURL + base.getIPs,
            params:params
        })
    },
    getCategoryList(params){
        return axios({
            method:'get',
            url:base.baseURL + base.category_list,
            params:params
        })
    },
    download_pakage(params){
        return axios({
            method:'post',
            url:base.baseURL + base.download_pakage,
            data:params,
            responseType:"blob"
        })
    },
    create_task(params){
        return axios({
            method:'post',
            url:base.baseURL + base.tasks,
            data:params
        })
    },
    edit_source_caterial(params){
        return axios({
            method:'post',
            url:base.baseURL + base.source_caterial,
            data:params
        })
    },
    get_source_caterial(params){
        return axios({
            method:'get',
            url:base.baseURL + base.source_caterial,
            params:params
        })
    },
    get_xhs_account(params){
        return axios({
            method:'get',
            url:base.baseURL + base.get_xhs_account,
            params:params
        })
    },
    get_tasks(params){
        return axios({
            method:'get',
            url:base.baseURL + base.tasks,
            params:params
        })
    },
    delete_task(id){
        return axios({
            method:'delete',
            url:`${base.baseURL}${base.task}${id}/`
        })
    },
    update_task(id, params){
        return axios({
            method:'put',
            url:`${base.baseURL}${base.task}${id}/`,
            data:params
        })
    },
}

export default api